<template>
  <section class="main">
    <ul class="todo-list">
      <li class="todo" v-for="(item,index) in  list" :key="item.id">
        <div class="view">
          <span class="index">{{index+1}}</span>
          <label>{{item.name}}</label>
          <button @click="del(item.id)" class="destroy"></button>
        </div>
      </li>
    </ul>
  </section>
</template>

<script>
export default {
  // 完整写法  props：{数据名：{ type：数据类型，reqeired：true  reqeired 是否传值}}
  props: {
   list:{
     type: Array,
    required: true
   }
  },
  methods:{
    del(id){
      this.$emit('sendId',id)
    }
  }
};
</script>

<style>
</style>